fix(routing): strip unsupported params when routing to Haiku#8
Open
vadymc wants to merge 1 commit intoRelayPlane:mainfrom
Open
fix(routing): strip unsupported params when routing to Haiku#8vadymc wants to merge 1 commit intoRelayPlane:mainfrom
vadymc wants to merge 1 commit intoRelayPlane:mainfrom
Conversation
Requests originating from Opus (with 1M context, effort, thinking)
were failing with 400 errors when the proxy routed them to Haiku.
Three issues fixed:
- context-1m beta header: only stripped for Sonnet, now stripped for
all non-Opus models (Haiku rejects it too)
- output_config.effort: Claude Code sends {"effort":"high"} inside
output_config which Haiku does not support. Strip it in both native
and cascade handlers.
- cascade handler: was passing raw ctx (with context-1m) instead of
stripped ctx to forwardNativeAnthropicRequest. Also uses copy-on-write
for output_config so cascade escalation to Sonnet/Opus retains effort.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
context-1mbeta header: was only stripped for Sonnet; now stripped for all non-Opus models. Haiku rejects it withThe long context beta is not yet available for this subscription.output_config.effort: Claude Code sends{"effort":"high"}insideoutput_configwhich Haiku does not support, causingThis model does not support the effort parameter. Stripped in both native and cascade handlers.ctx: was forwarding the unstripped context (withcontext-1mbeta) toforwardNativeAnthropicRequest. Now constructs a per-attemptcascadeCtxwith the beta stripped.output_configis a shared nested object across cascade attempts. Uses copy-on-write (destructuring) instead ofdeleteso cascade escalation from Haiku → Sonnet/Opus retains theeffortparam.Test plan
strip-unsupported-params.test.ts(17 total, all passing)output_config.effortwas the actual field causing the 400 error🤖 Generated with Claude Code